<%--
  Created by IntelliJ IDEA.
  User: Y9000P
  Date: 2024.05.27
  Time: 13:11
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>添加与修改</title>
</head>
<body>
<form action="/product?userReq=save" method="post">
    <table>
        <tr>
            <%--添加与修改属性
            都有id属性,但不需要用户操作,因此隐藏(hidden)
            value属性:在执行修改操作时,通过EL表达式获取作用域中的共享数据显示--%>
            <td><input type="hidden" name="id" value="${product.id}"></td>
        </tr>
        <tr>
            <td>商品名称</td>
            <td><input type="text" name="productName" value="${product.productName}"></td>
        </tr>
        <tr>
            <td>商品编号</td>
            <td>
                <%--EL表达式:表示在执行修改操作时,获取查询到的分类编号,是否和当前一致,如果一致则被选中--%>
                <select name="dir_id">
                    <option value="101" ${product.dir_id==101?'selected':''}>101</option>
                    <option value="102" ${product.dir_id==102?'selected':''}>102</option>
                    <option value="103" ${product.dir_id==103?'selected':''}>103</option>
                    <option value="104" ${product.dir_id==104?'selected':''}>104</option>
                    <option value="105" ${product.dir_id==105?'selected':''}>105</option>
                    <option value="201" ${product.dir_id==201?'selected':''}>201</option>
                    <option value="202" ${product.dir_id==202?'selected':''}>202</option>
                    <option value="203" ${product.dir_id==203?'selected':''}>203</option>
                </select>
            </td>
        </tr>
        <tr>
            <td>商品单价</td>
            <td><input type="text" name="salPrice" value="${product.salPrice}"></td>
        </tr>
        <tr>
            <td>供货商</td>
            <td><input type="text" name="supplier" value="${product.supplier}"></td>
        </tr>
        <tr>
            <td>品牌</td>
            <td><input type="text" name="brand" value="${product.brand}"></td>
        </tr>
        <tr>
            <td>折扣</td>
            <td><input type="text" name="cutoff" value="${product.cutoff}"></td>
        </tr>
        <tr>
            <td>商品进价</td>
            <td><input type="text" name="costPrice" value="${product.costPrice}"></td>
        </tr>
        <tr>
            <td colspan="2"><input type="submit" value="保存"></td>
        </tr>

    </table>
</form>
</body>
</html>
